gmfn: machine physical frame number
The size of arrays is stored in xch_nr_pages member of header
note descriptor in .note.Xen note section.
- There is no rule about the order. Analysis tools must no rely
- on its order.
+ The entryies are stored in pfn-ascending order.
This section must exist when the domain is non auto
translated physmap mode. Currently x86 paravirtualized domain.
in .xen_pages section.
The size of arrays is stored in xch_nr_pages member of header
note descriptor in .note.Xen note section.
- There is no rule about the order. Analysis tools must no rely
- on its order.
+ The entries are stored in ascending order.
This section must exist when the domain is auto translated
physmap mode. Currently x86 full virtualized domain and
ia64 domain.
[When the format is changed, it would be described here.]
(0, 1) update
+- .xen_p2m, .xen_pfn section
+ Arrays must be in pfn ascending order for efficient looking up.
- EI_CLASS member of elf header was changed to ELFCLASS64 independent of
architecture. This is mainly for x86_32pae.
The format version isn't bumped because analysis tools can distinguish it.
#include "xc_core.h"
#include "xc_efi.h"
#include "xc_dom.h"
+#include <inttypes.h>
+
+static int
+xc_memory_map_cmp(const void *lhs__, const void *rhs__)
+{
+ const struct xc_core_memory_map *lhs =
+ (const struct xc_core_memory_map *)lhs__;
+ const struct xc_core_memory_map *rhs =
+ (const struct xc_core_memory_map *)rhs__;
+
+ if (lhs->addr < rhs->addr)
+ return -1;
+ if (lhs->addr > rhs->addr)
+ return 1;
+
+ /* memory map overlap isn't allowed. complain */
+ DPRINTF("duplicated addresses are detected "
+ "(0x%" PRIx64 ", 0x%" PRIx64 "), "
+ "(0x%" PRIx64 ", 0x%" PRIx64 ")\n",
+ lhs->addr, lhs->size, rhs->addr, rhs->size);
+ return 0;
+}
int
xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
}
*mapp = map;
*nr_entries = i;
+ qsort(map, *nr_entries, sizeof(map[0]), &xc_memory_map_cmp);
return 0;
out:
ret = 0;
out:
munmap(memmap_info, PAGE_SIZE);
+ qsort(map, *nr_entries, sizeof(map[0]), &xc_memory_map_cmp);
return ret;
old: